﻿@model IEnumerable<BTKERP.Model.GRNMaster>

@{
    ViewBag.Title = "Good Receive Note";
}
 <script type="text/javascript">
        function addNewProduct() {
            window.location = "/GRN/Create";
        }
</script>
<h2>GRN List</h2>

<p>
   <input type="button" value="New GRN" class="btn btn-green" onclick="addNewProduct();" />
</p>
<table class="display stylized">
    <tr>
        <th>
            GRN Code
        </th>
        <th>
            GRN Date
        </th>
        <th>
            Supplier
        </th>
        <th>
            Received Warehouse
        </th>
        <th>
            Remark
        </th>
        <th>
            Quantity
        </th>
        <th>
            Value
        </th>
        <th>
            Status
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.GRNCode)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.GRNDate)
        </td>
        <td>
            @BTKERP.MVCWeb.AppCode.DataRefHelper.GetSupplierById(item.SupplierId)
        </td>
        <td>
            @BTKERP.MVCWeb.AppCode.DataRefHelper.GetWarehouseById(item.ReceivedWarehouseId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Remark)
        </td>
        <td>
            Received Qty
        </td>
        <td>
            Received Value
        </td>
        <td>
            @BTKERP.MVCWeb.AppCode.DataRefHelper.GetGRNStatus(item.Status)
        </td>
        <td>
            @if (item.Status == 0)
            {
            <b>@Html.ActionLink("Manage", "Manage", new { id = item.Id })</b>
            }
            else{
                <b>@Html.ActionLink("Details", "Details", new { id = item.Id })</b> 
            }
        </td>
    </tr>
}

</table>
